class NguoiDungMailer < ActionMailer::Base
  default from: "qcafe.dev@gmail.com"
  def tao_mat_khau_moi_email(nguoi_dung, url)
    @nguoi_dung  = nguoi_dung
    @url  = url_for(
      :action => 'tao_mat_khau',
      :controller => 'nguoi_dung',
      #:only_path => false,
      :token => nguoi_dung.mat_khau_moi_token,
      :host => url
    )
    return mail(
      :to => nguoi_dung.email,
      :subject => t('email_vars.tao_mat_khau_moi_email_subject'),
      :content_type => 'text/html'
    )
  end

  def xac_nhan_dang_ki_email(nguoi_dung, url)
    @nguoi_dung  = nguoi_dung
    @url = url_for(
      :action => 'xac_nhan_dang_ki',
      :controller => 'nguoi_dung',
      #:only_path => false,
      :token => nguoi_dung.mat_khau_moi_token,
      :host => url
    )
    return mail(
      :to => nguoi_dung.email,
      :subject => t('email_vars.xac_nhan_dang_ki_email_subject'),
      :content_type => 'text/html'
    )
  end
  
  def lien_he_email(email, ten, noi_dung, email_nhan)
    @email_nguoi_gui = email
    @ten_nguoi_gui = ten
    @noi_dung = noi_dung
    return mail(
      :to => email_nhan,
      :subject => t('email_vars.lien_lac_tu_khach_hang_subject'),
      :content_type => 'text/html'
    )
  end
end
